import React,{Component} from 'react'
import Tab from './Tab.jsx'
import Form from './Form'
class Child extends Component {
    constructor(){
        super()
        this.state={
            list:[
                {"id":1,"user":"o","age":15},
                {"id":2,"user":"o2","age":19},
            ]
        }
    }
    addListFn=(r)=>{
        console.log(r);
        let list = JSON.parse( JSON.stringify( this.state.list ) );
            list.push( r );

            this.setState({
                list:list
            })
   }
    render () {
        return (
            <div>
                <Form addList={this.addListFn}></Form>
                <Tab list={this.state.list}></Tab>
            </div>
        )
    }
}
export default Child